package com.csq.portal.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.csq.cms.service.ResumeService;
import com.csq.manager.pojo.Account;
import com.csq.manager.pojo.Resume;

@Controller
@RequestMapping("/resume")
public class ResumeController {

	@Autowired
	private ResumeService resumeService;

	@RequestMapping(value = "/editResume")
	public String editResume(Resume resume, HttpServletRequest request) {
		Account redisAccount = (Account) request.getSession().getAttribute(
				"account");

		// resumeId 不为空 更新简历
		if (resume.getResumeId() != null) {
			resume.setUserId(redisAccount.getUserId());

			resumeService.updateResume(resume);

			// resumeId 为空, 展示简历
		}
		Resume resume2 = resumeService.getResume(redisAccount.getUserId());
		request.setAttribute("resume", resume2);

		return "/web/acount/editResume";
	}
}
